<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width = device-width, initial-scale = 1.0, minimum-scale = 1.0, maximum-scale = 1.0, user-scalable = no"/>
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<meta name="format-detection" content="telephone=no">
<meta name="keywords" content="" /> 
<meta name="description" content="" />
<title>商品发布</title>
<link type="text/css" href="../css/reset.css" rel="stylesheet" />
<link type="text/css" href="../css/public.css" rel="stylesheet" />
<link type="text/css" href="../css/style.css" rel="stylesheet" />
<link type="text/css" href="../css/wode.css" rel="stylesheet" />
<script>
    var deviceWidth = Math.min(640, window.innerWidth)
    document.documentElement.style.fontSize = deviceWidth / 7.5 + "px"
</script>
<script src="../js/jquery.min.js?v=2.1.4"></script>
<script src="../js/core.js"></script>
<script src="../js/24.2.0fabugoods.js"></script>
</head>
<body>
<!-- top -->
<div class="header">
    <header class="p_header public-red">
        <a href="javascript:history.go(-1);" class="p_header_left">
            <i class="p_left" title="返回"></i>
        </a>
        <h1 class="p_dizhi">商品发布</h1>
    </header>
</div>
<!--免费开店-->
<form>
	<input type="hidden" id="fengmian" />
	<div class="dingdan_title">封面图</div>
	<div class="kaidian_dianpu">
		<div class="fabu_fengmian">
			<div id="preview1">
	            <img onerror="errorImg(this)" id="imghead1" border=0 src="../images/moren.jpg" />
	        </div>
	        <div class="fabu_file1"><input type="file" id="fengmian" onchange="previewImage1(this)" /></div>
		</div>
	</div>
	
	<div class="kaidian_dianpu" style="display: none;">
		<div class="fabu_fengmian">
			<div id="preview22">
	            <img onerror="errorImg(this)" id="imghead22" border=0 src="../images/moren.jpg" />
	        </div>
	        <div class="fabu_file1"><input type="file" id="fengmian"  /></div>
		</div>
	</div>
	
	<div class="dingdan_title">细节图</div>
	<div class="mm_imgfile">
            <ul class="clearfix" >
            	<div id="xunhuan">
            		
            	</div>
                <li>
                    <img onerror="errorImg(this)" src="../images/moren.jpg">
                    <input type="file" id="xijietu" onchange="previewImage2(this)">
                </li>
            </ul>
        </div>
	
	<div class="dingdan_title">商品标题</div>
	<div class="sell_fabu_input">
		<input type="text" placeholder="清晰的属性文字买家更容易搜到"  id="biaoti"/>
	</div>
	<div class="dingdan_title">商品描述</div>
	<div class="sell_fabu_input" id="miaoshu2">
		<textarea placeholder="商品描述必须如实发布，不能含有虚报材料成分，如真皮草100%原材料成分等，违者扣分处罚。" onchange="jianting()" id="miaoshu"></textarea>
		<p id="wenleng">0/1000</p>
	</div>
	
	<!--批发价-->
	<div class="public-jianxi"></div>
	<div class="sell_fabu_price">
		<li class="clearfix">
			<label>批发价(元)</label>
			<input type="number" class="sell_fabu_prve" placeholder="请输入商品批发价格" id="pifajia"/>
			<input type="number" class="sell_fabu_next" placeholder="请输入件数" id="jianhsu"/>
		</li>
		<!--<li class="clearfix">
			<label>拿货价(元)</label>
			<input type="number" class="sell_fabu_prve" placeholder="请输入商品拿货价格" id="nahuojia"/>
			<input type="number" class="sell_fabu_next" placeholder="请输入件数" id="nahuojianshu"/>
		</li>-->
		<li class="clearfix">
			<label>打包价(元)</label>
			<input type="number" class="sell_fabu_prve" placeholder="请输入商品打包价格" id="dabaojiage"/>
			<input type="number" class="sell_fabu_next" placeholder="请输入件数" id="dabaojianshu"/>
		</li>
		<li class="clearfix">
			<label>库存数</label>
			<input type="number" class="sell_fabu_next" placeholder="请输入件数" id="shuliangs"/>
		</li>
	</div>
	<div class="public-jianxi"></div>
	<!---->
	<div class="sell_fabu_guige">
		<ul>
			<li class="clearfix color_li">
				<label>选择颜色</label>
				<span id="yanshes" >如图</span>
			</li>
			<li class="clearfix chima_li">
				<label>选择尺码</label>
				<span id="chimas" >如图</span>
			</li>
		</ul>
	</div>
	<div class="public-jianxi"></div>
	<!---->
	<div class="sell_fabu_guige">
		<ul>
			<li class="clearfix" id="showCityPicker">
				<label>商品分类</label>
				<span id="cityResult"></span>
			</li>
			<li class="clearfix"   onclick="window.location.href= '24.2.4fabu_goods_shuxing.html';return false,dianjila()">
				<label>商品属性</label>
				<span id="mingzi"></span>
			</li>
			<li class="clearfix">
				<label>重量</label>
				<input type="number" placeholder="单位为公斤，0为包邮" id="zhognliang"/>
			</li>
		</ul>
	</div>
	<div class="public-jianxi"></div>
	<!---->
	
	<input type="hidden" value="0" id="tuichun">
	<input type="hidden" value="0"  id="huiyuanguankan"/>
	<input  type="hidden" value="0"  id="banshibaohu"/>
	<input type="hidden" id="sizeid"  />
	<input type="hidden" id="colorid"/>
	<input type="hidden" id="propertyTypeIds" />
	<div class="sell_fabu_guige">
		<ul>
			<li class="clearfix">
				<label>推荐到首页</label>
				<div class="fl jg_swith">
					 <div onclick="tuijian(this)">
					 		<div id="tuijians" class="mui-switch mui-switch-mini">
	            		<div class="mui-switch-handle"></div>
					</div>
					 </div>
	            
					
	            </div>
	            <p>今日还可以推荐<em id="chisu">0</em>次</p>
			</li>
		
		</ul>
	</div>
	<div class="public-jianxi"></div>
	<!---->
	<div class="sell_fabu_guige">
		<ul>
			<li class="clearfix" style="border-bottom: none;">
				<label>版式保护</label>
				<div class="fl jg_swith"  onclick="banshibaohus2(this)">
	            	<div id="banquanss" class="mui-switch mui-switch-mini">
	            		<div class="mui-switch-handle"></div>
					</div>
	           </div>
			</li>
			<div class="sell_fabu_tishi">开启后，只有经过佳港认证的用户才可看到，同时商品的曝光机会减少</div>
		</ul>
	</div>

	<div class="mid-width" id="xiugaifabu">
	    <input type="button" class="p_button" onclick="fabushangping()" value="提交">
	</div>
	
    
</form>

<!--底部-->


<!--尺寸选择-->
<div class="p-chima chima_show">
	<h5>常用尺码</h5>
	<ul class="clearfix Chima" id="chaxunchima">
		
	</ul>
		<div class="p_chima_div clearfix">
		<input type="text" id="sizeName" placeholder="请输入新的尺码" />
		<input type="button" onclick="addNew2()" value="添加新尺码" />
	</div>
	<div class="mid-width">
		<input type="button" class="p_button" id="chima_hide" onclick="wanchengsize()" value="完成" />
	</div>
</div>


<!--颜色选择-->
<div class="p-chima color_show">
	
<h5>常用颜色&nbsp;&nbsp;&nbsp;&nbsp;
	    <input id="full" />
	</h5>
	<dl class="Color clearfix" id="chanyongshe">

		
	</dl>
	<div class="p_chima_div clearfix">
		<input type="text" id="Newcolor" placeholder="请输入新的颜色" />
		<input type="button" onclick="addNew()" value="添加新颜色" />
	</div>
	<div class="mid-width">
		<input type="button"  class="p_button" onclick="wanchengcolore()"  id="color_hide" value="完成" />
	</div>
</div>




<div id="bg"></div>



<script src="../js/bank.js" type="text/javascript" charset="utf-8"></script>
<script type="text/javascript" src="../js/jquery-1.10.1.min.js"></script>
<script>
	function tuijian(te){
		var chisu=$("#chisu").html();
		if(chisu!="0"){
			$("#tuichun").val(0);
		var cl=$(te).attr("class");
		if(cl!="mui-switch mui-switch-mini"){
			$("#tuichun").val(1);
			
		}
		}else{
			$(te).html("");
			/*$(te).attr("data-switch","2");
			$(te).attr("class","mui-switch mui-switch-mini");*/
			var ss='<div id="tuijians" class="mui-switch mui-switch-mini">'+
	            		'<div class="mui-switch-handle"></div>'+
					'</div>';
			$(te).html(ss);
			$("#tuichun").val(0);
			alert("推荐次数不足");
		}
	}
	/*function huiyaun(te){
		$("#huiyuanguankan").val(0);
		var cl=$(te).attr("class");
		if(cl!="mui-switch mui-switch-mini"){
			$("#huiyuanguankan").val(1);
		}
		
	}*/
	
	function banshibaohus2(te){
		 if(uuuuid!=""){
		 	  $.ajax({
            url: urlcore + "/api/bullInfo/selectbull?userId="+uuuuid,
			type: "get",
			dataType: 'json',
			contentType: "application/json;charset=utf-8",
			success: function(data) {
				if(data.success == true) {
					var da=data.data;
					       if(da!=null && da!=""){
					       	 if(da.status==1){
						 $("#banshibaohu").val(0);
		            var cl=$(te).attr("class");
		       if(cl!="mui-switch mui-switch-mini"){
	      		$("#banshibaohu").val(1);
	        	}
						   }else if(da.status==2){
                         $(te).html("");
			var ss='<div id="banquanss" class="mui-switch mui-switch-mini">'+
	            		'<div class="mui-switch-handle"></div>'+
					'</div>';
			$(te).html(ss);
			$("#banshibaohu").val(0);
			alert("实名认证失败");
						   }else if(da.status==0){
						            $(te).html("");
			var ss='<div id="banquanss" class="mui-switch mui-switch-mini">'+
	            		'<div class="mui-switch-handle"></div>'+
					'</div>';
			$(te).html(ss);
			$("#banshibaohu").val(0);
			alert("实名认证中");
						   	
						   }
					       }else{
					       	
						            $(te).html("");
			var ss='<div id="banquanss" class="mui-switch mui-switch-mini">'+
	            		'<div class="mui-switch-handle"></div>'+
					'</div>';
			$(te).html(ss);
			$("#banshibaohu").val(0);
			alert("未认证");
						   	
						   
					       }
				} else {
						            $(te).html("");
			var ss='<div id="banquanss" class="mui-switch mui-switch-mini">'+
	            		'<div class="mui-switch-handle"></div>'+
					'</div>';
			$(te).html(ss);
			$("#banshibaohu").val(0);
			alert("返回失败");
					
				}
			},
			error: function() {
				alert("error");
			}
		});
		 }else{
		 	
						            $(te).html("");
			var ss='<div id="banquanss" class="mui-switch mui-switch-mini">'+
	            		'<div class="mui-switch-handle"></div>'+
					'</div>';
			$(te).html(ss);
			$("#banshibaohu").val(0);
			alert("未登录");
					
				
		 }
	}
	
	
</script>
<link rel="stylesheet" href="../css/mui.min.css">
<!--App自定义的css-->
<link rel="stylesheet" type="text/css" href="../css/app.css" />
<link href="../css/mui.picker.css" rel="stylesheet" />
<link href="../css/mui.poppicker.css" rel="stylesheet" />
<script src="../js/mui.min.js" type="text/javascript" charset="utf-8"></script>
<script src="../js/mui.picker.js" type="text/javascript" charset="utf-8"></script>

<script src="../js/mui.poppicker.js" type="text/javascript" charset="utf-8"></script>
<script type="text/javascript">
		var maxCount = 1000;  // 最高字数，这个值可以自己配置
$("#miaoshu").on('keyup', function() {  /*其实不难，就是在键盘的keyup事件中获取现在输入字数的长度。*/
    var len = getStrLength(this.value);
    $("#wenleng").html(maxCount-len);
})
// 中文字符判断
function getStrLength(str) { 
    var len = str.length; 
    var reLen = 0; 
    for (var i = 0; i < len; i++) {        
        if (str.charCodeAt(i) < 27 || str.charCodeAt(i) > 126) { 
            // 全角    
            reLen += 2; 
        } else { 
            reLen++; 
        } 
    } 
    return reLen;    
}
	 //var goodsstype=0;
	//$("#goodsleibie").val(goodsstype);
				(function($, doc) {
		$.init();
		$.ready(function() {
     $.ajax({
     	async: false,
		url: urlcore + "/api/sortType/wxselectTwoList",
		type: "get",
		dataType: 'json',
		contentType: "application/json;charset=utf-8",
		success:function(data){
			if (data.success == true) {
				  var goodsData="[";
				  $.each(data.data.list,function(y,n){
				  	if(y==0){
				  	goodsData+='{value:"'+n.id+'",text: "'+n.sortName+'"';
				  	if(n.wxSortTypeList!=null){
				  		goodsData+=',children: [';
				  	 $.each(n.wxSortTypeList,function(q,m){
				  	 	   if(q==0){
				  	 	   	goodsData+='{value: "'+m.id+'",text: "'+m.sortName+'"}';
				  	 	   }else{
				  	 	   goodsData+=',{value: "'+m.id+'",text: "'+m.sortName+'"}';
				  	 	   }
				  		});
				  			goodsData+=']';
				  	}
				  	goodsData+='}';
				  	}else{
				  	goodsData+=',{value:"'+n.id+'",text: "'+n.sortName+'"';
				  	if(n.wxSortTypeList!=null){
				  		goodsData+=',children: [';
				  	 $.each(n.wxSortTypeList,function(q,m){
				  	 	   if(q==0){
				  	 	   	goodsData+='{value: "'+m.id+'",text: "'+m.sortName+'"}';
				  	 	   }else{
				  	 	   goodsData+=',{value: "'+m.id+'",text: "'+m.sortName+'"}';
				  	 	   }
				  		});
				  			goodsData+=']';
				  	}
				  		goodsData+='}';
				  	}
				  })
				   goodsData+="]";
			//级联示例
				var cityPicker = new $.PopPicker({
				layer: 2
			});
	       // var arrs = ;	
	       	
	        var newData = eval(goodsData); //字符串形式的 转成数组
			cityPicker.setData(newData);
			var showCityPickerButton = doc.getElementById('showCityPicker');
			var cityResult = doc.getElementById('cityResult');
			showCityPickerButton.addEventListener('tap', function(event) {
				cityPicker.show(function(items) {
					cityResult.innerText = items[0].text +'-'+ items[1].text;
	                 sessionStorage.setItem("goodsleibie",items[1].value);	
	                 sessionStorage.setItem("goodsleibiename",items[0].text +'-'+ items[1].text)
				});
			}, false);
			
			}
		},
		error:function() {
			// Act on the event 
			alert("error");
		}
	});
	
	      });
	      
			})(mui,document);
			
			
			
			
	
	
	// 尺码
    // 弹出
    $(".chima_li").on('click',function(){
        $("body").append("<div id='mask'></div>");
        $(".chima_show").show();
    })
    //点击关闭
    $("#chima_hide").on('click',function(){
        $(".chima_show").hide();
        $("#mask").remove();
    }) 
    
    
    // 颜色
    // 弹出
    $(".color_li").on('click',function(){
        $("body").append("<div id='mask'></div>");
        $(".color_show").show();
    })
    
    //点击关闭
    $("#color_hide").on('click',function(){
        $(".color_show").hide();
        $("#mask").remove();
    }) 
	
	
	//选择尺码
	
	$(document).ready(function(){                      
        $(".Chima li").each(function(){
            $(this).click(function () {
            	
                if ($(this).hasClass('ALL')) {
                    $(this).addClass('p_chima_curr').siblings().removeClass('p_chima_curr');
                }else{
                	$('.ALL').removeClass('p_chima_curr');
                    $(this).addClass('p_chima_curr');
                }
            }); 
        });
    });
	
//	$(document).ready(function(){                      
//      $(".Chima li").each(function(){
//          $(this).click(function () {
//          	
////              $(this).addClass('p_chima_curr');
//              if ($(this).data() == '均码') {
//                  $(this).addClass('p_chima_curr').siblings().removeClass('p_chima_curr');
//              }else{
//                  $(this).eq(0).removeClass('p_chima_curr').addClass('p_chima_curr');;
////                  $(this).addClass('p_chima_curr');
//              }
//          }); 
//      });
//  });
	
	
//	$('.Chima li').on('click',function(){
//	    //给菜单添加选择样式
//	    
//	    alert($(this).index());
//	    if ($(this).html == '均码') {
//	    			 
//	    } else{
//	    	$(this).addClass('p_chima_curr').siblings().removeClass('p_chima_curr');
//	    }
//	    
//	    
//	    
//	   
//	});
	
	//颜色
	$('.Color dd').on('click',function(){
	    //给菜单添加选择样式
	    $(this).find('i').show();
	   
	});
		
</script>
<!--上传-->
<script type="text/javascript" src="../js/upload.js"></script>
<script type="text/javascript">
	$(".mm_imgfile input[type=file]").change(function(){
        var fs = this.files,$t  = $(this);
        $(fs).each(function(){
              var reader = new FileReader();
                reader.readAsDataURL(this);
                reader.onload = function(e) {
                    $t.parent().parent().prepend($('<li><input type="text" style="display: none;"  class="classa" id="xijietu"/><img src="'+this.result+'"><span data-name="delete" onclick="shanchu(this)"></span></li>'));
                }
        });
    });
    
   function shanchu(te){
    	//删除+
    	 $(te).closest("li").remove();
    	//$(".youds"+te);
    }
</script>
<script>
	function jianting(){
		if($("#miaoshu").val().length>1000){
			alert("文本超过长度");
			$("#wenleng").html($("#miaoshu").val().length+"/1000");
		}else{
			$("#wenleng").html($("#miaoshu").val().length+"/1000");
		}
	}
</script>
<link rel="stylesheet" type="text/css" href="../Subsidiary/spectrum.css">
<script type="text/javascript" src="../Subsidiary/jquery.min.js"></script>
<script type="text/javascript" src="../Subsidiary/spectrum.js"></script>
<script type='text/javascript' src='../Subsidiary/docs.js'></script>
</body>
</html>